home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / Speech.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  11.4 KB  |  570 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Speech.a
  3. ;
  4. ;    Contains:    Speech Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__SPEECH__') = 'UNDEFINED' THEN
  21. __SPEECH__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  30.     include 'Memory.a'
  31.     ENDIF
  32. ;        include 'MixedMode.a'                                        ;
  33.  
  34.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  35.     include 'Files.a'
  36.     ENDIF
  37. ;        include 'OSUtils.a'                                        ;
  38.  
  39. kTextToSpeechSynthType            EQU        'ttsc'
  40. kTextToSpeechVoiceType            EQU        'ttvd'
  41. kTextToSpeechVoiceFileType        EQU        'ttvf'
  42. kTextToSpeechVoiceBundleType    EQU        'ttvb'
  43.  
  44. kNoEndingProsody                EQU        1
  45. kNoSpeechInterrupt                EQU        2
  46. kPreflightThenPause                EQU        4
  47.  
  48. kImmediate                        EQU        0
  49. kEndOfWord                        EQU        1
  50. kEndOfSentence                    EQU        2
  51.  
  52. ;------------------------------------------
  53. ; GetSpeechInfo & SetSpeechInfo selectors    
  54. ;------------------------------------------
  55. soStatus                        EQU        'stat'
  56. soErrors                        EQU        'erro'
  57. soInputMode                        EQU        'inpt'
  58. soCharacterMode                    EQU        'char'
  59. soNumberMode                    EQU        'nmbr'
  60. soRate                            EQU        'rate'
  61. soPitchBase                        EQU        'pbas'
  62. soPitchMod                        EQU        'pmod'
  63. soVolume                        EQU        'volm'
  64. soSynthType                        EQU        'vers'
  65. soRecentSync                    EQU        'sync'
  66. soPhonemeSymbols                EQU        'phsy'
  67. soCurrentVoice                    EQU        'cvox'
  68. soCommandDelimiter                EQU        'dlim'
  69. soReset                            EQU        'rset'
  70. soCurrentA5                        EQU        'myA5'
  71. soRefCon                        EQU        'refc'
  72. soTextDoneCallBack                EQU        'tdcb'
  73. soSpeechDoneCallBack            EQU        'sdcb'
  74. soSyncCallBack                    EQU        'sycb'
  75. soErrorCallBack                    EQU        'ercb'
  76. soPhonemeCallBack                EQU        'phcb'
  77. soWordCallBack                    EQU        'wdcb'
  78. soSynthExtension                EQU        'xtnd'
  79. soSoundOutput                    EQU        'sndo'
  80.  
  81. ;------------------------------------------
  82. ; Speaking Mode Constants                     
  83. ;------------------------------------------
  84. modeText                        EQU        'TEXT'                ; input mode constants                     
  85. modePhonemes                    EQU        'PHON'
  86. modeNormal                        EQU        'NORM'                ; character mode and number mode constants 
  87. modeLiteral                        EQU        'LTRL'
  88.  
  89. soVoiceDescription                EQU        'info'
  90. soVoiceFile                        EQU        'fref'
  91.  
  92. SpeechChannelRecord     RECORD    0
  93. data                     ds.l   1        ; offset: $0 (0)
  94. sizeof                     EQU *            ; size:   $4 (4)
  95.                         ENDR
  96.  
  97. ; typedef struct SpeechChannelRecord  SpeechChannelRecord
  98. ; typedef SpeechChannelRecord  *SpeechChannel
  99. VoiceSpec                 RECORD    0
  100. creator                     ds.l   1        ; offset: $0 (0)
  101. id                         ds.l   1        ; offset: $4 (4)
  102. sizeof                     EQU *            ; size:   $8 (8)
  103.                         ENDR
  104.  
  105. ; typedef struct VoiceSpec     VoiceSpec
  106.  
  107. kNeuter                            EQU        0
  108. kMale                            EQU        1
  109. kFemale                            EQU        2
  110.  
  111. VoiceDescription         RECORD    0
  112. length                     ds.l   1        ; offset: $0 (0)
  113. voice                     ds     VoiceSpec ; offset: $4 (4)
  114. version                     ds.l   1        ; offset: $C (12)
  115. name                     ds.l   16        ; offset: $10 (16)
  116. comment                     ds.l   64        ; offset: $50 (80)
  117. gender                     ds.w   1        ; offset: $150 (336)
  118. age                         ds.w   1        ; offset: $152 (338)
  119. script                     ds.w   1        ; offset: $154 (340)
  120. language                 ds.w   1        ; offset: $156 (342)
  121. region                     ds.w   1        ; offset: $158 (344)
  122. reserved                 ds.l   4        ; offset: $15A (346)
  123. sizeof                     EQU *            ; size:   $16A (362)
  124.                         ENDR
  125.  
  126. ; typedef struct VoiceDescription  VoiceDescription
  127. VoiceFileInfo             RECORD    0
  128. fileSpec                 ds     FSSpec    ; offset: $0 (0)
  129. resID                     ds.w   1        ; offset: $46 (70)
  130. sizeof                     EQU *            ; size:   $48 (72)
  131.                         ENDR
  132.  
  133. ; typedef struct VoiceFileInfo  VoiceFileInfo
  134. SpeechStatusInfo         RECORD    0
  135. outputBusy                 ds.b   1        ; offset: $0 (0)
  136. outputPaused             ds.b   1        ; offset: $1 (1)
  137. inputBytesLeft             ds.l   1        ; offset: $2 (2)
  138. phonemeCode                 ds.w   1        ; offset: $6 (6)
  139. sizeof                     EQU *            ; size:   $8 (8)
  140.                         ENDR
  141.  
  142. ; typedef struct SpeechStatusInfo  SpeechStatusInfo
  143. SpeechErrorInfo         RECORD    0
  144. count                     ds.w   1        ; offset: $0 (0)
  145. oldest                     ds.w   1        ; offset: $2 (2)
  146. oldPos                     ds.l   1        ; offset: $4 (4)
  147. newest                     ds.w   1        ; offset: $8 (8)
  148. newPos                     ds.l   1        ; offset: $A (10)
  149. sizeof                     EQU *            ; size:   $E (14)
  150.                         ENDR
  151.  
  152. ; typedef struct SpeechErrorInfo  SpeechErrorInfo
  153. SpeechVersionInfo         RECORD    0
  154. synthType                 ds.l   1        ; offset: $0 (0)
  155. synthSubType             ds.l   1        ; offset: $4 (4)
  156. synthManufacturer         ds.l   1        ; offset: $8 (8)
  157. synthFlags                 ds.l   1        ; offset: $C (12)
  158. synthVersion             ds     NumVersion ; offset: $10 (16)
  159. sizeof                     EQU *            ; size:   $14 (20)
  160.                         ENDR
  161.  
  162. ; typedef struct SpeechVersionInfo  SpeechVersionInfo
  163. PhonemeInfo             RECORD    0
  164. opcode                     ds.w   1        ; offset: $0 (0)
  165. phStr                     ds.l   4        ; offset: $2 (2)
  166. exampleStr                 ds.l   8        ; offset: $12 (18)
  167. hiliteStart                 ds.w   1        ; offset: $32 (50)
  168. hiliteEnd                 ds.w   1        ; offset: $34 (52)
  169. sizeof                     EQU *            ; size:   $36 (54)
  170.                         ENDR
  171.  
  172. ; typedef struct PhonemeInfo  PhonemeInfo
  173. PhonemeDescriptor         RECORD    0
  174. phonemeCount             ds.w   1        ; offset: $0 (0)
  175. thePhonemes                 ds     PhonemeInfo ; offset: $2 (2)
  176. sizeof                     EQU *            ; size:   $38 (56)
  177.                         ENDR
  178.  
  179. ; typedef struct PhonemeDescriptor  PhonemeDescriptor
  180. SpeechXtndData             RECORD    0
  181. synthCreator             ds.l   1        ; offset: $0 (0)
  182. synthData                 ds.b   2        ; offset: $4 (4)
  183. sizeof                     EQU *            ; size:   $6 (6)
  184.                         ENDR
  185.  
  186. ; typedef struct SpeechXtndData  SpeechXtndData
  187. DelimiterInfo             RECORD    0
  188. startDelimiter             ds.b   2        ; offset: $0 (0)
  189. endDelimiter             ds.b   2        ; offset: $2 (2)
  190. sizeof                     EQU *            ; size:   $4 (4)
  191.                         ENDR
  192.  
  193. ; typedef struct DelimiterInfo  DelimiterInfo
  194. ;
  195. ; pascal NumVersion SpeechManagerVersion(void)
  196. ;
  197.     IF ¬ GENERATINGCFM THEN
  198.         Macro
  199.         _SpeechManagerVersion
  200.             dc.w     $203C
  201.             dc.w     $0000
  202.             dc.w     $000C
  203.             dc.w     $A800
  204.         EndM
  205.     ELSE
  206.         IMPORT_CFM_FUNCTION    SpeechManagerVersion
  207.     ENDIF
  208.  
  209. ;
  210. ; pascal OSErr MakeVoiceSpec(OSType creator, OSType id, VoiceSpec *voice)
  211. ;
  212.     IF ¬ GENERATINGCFM THEN
  213.         Macro
  214.         _MakeVoiceSpec
  215.             dc.w     $203C
  216.             dc.w     $0604
  217.             dc.w     $000C
  218.             dc.w     $A800
  219.         EndM
  220.     ELSE
  221.         IMPORT_CFM_FUNCTION    MakeVoiceSpec
  222.     ENDIF
  223.  
  224. ;
  225. ; pascal OSErr CountVoices(short *numVoices)
  226. ;
  227.     IF ¬ GENERATINGCFM THEN
  228.         Macro
  229.         _CountVoices
  230.             dc.w     $203C
  231.             dc.w     $0108
  232.             dc.w     $000C
  233.             dc.w     $A800
  234.         EndM
  235.     ELSE
  236.         IMPORT_CFM_FUNCTION    CountVoices
  237.     ENDIF
  238.  
  239. ;
  240. ; pascal OSErr GetIndVoice(short index, VoiceSpec *voice)
  241. ;
  242.     IF ¬ GENERATINGCFM THEN
  243.         Macro
  244.         _GetIndVoice
  245.             dc.w     $203C
  246.             dc.w     $030C
  247.             dc.w     $000C
  248.             dc.w     $A800
  249.         EndM
  250.     ELSE
  251.         IMPORT_CFM_FUNCTION    GetIndVoice
  252.     ENDIF
  253.  
  254. ;
  255. ; pascal OSErr GetVoiceDescription(VoiceSpec *voice, VoiceDescription *info, long infoLength)
  256. ;
  257.     IF ¬ GENERATINGCFM THEN
  258.         Macro
  259.         _GetVoiceDescription
  260.             dc.w     $203C
  261.             dc.w     $0610
  262.             dc.w     $000C
  263.             dc.w     $A800
  264.         EndM
  265.     ELSE
  266.         IMPORT_CFM_FUNCTION    GetVoiceDescription
  267.     ENDIF
  268.  
  269. ;
  270. ; pascal OSErr GetVoiceInfo(VoiceSpec *voice, OSType selector, void *voiceInfo)
  271. ;
  272.     IF ¬ GENERATINGCFM THEN
  273.         Macro
  274.         _GetVoiceInfo
  275.             dc.w     $203C
  276.             dc.w     $0614
  277.             dc.w     $000C
  278.             dc.w     $A800
  279.         EndM
  280.     ELSE
  281.         IMPORT_CFM_FUNCTION    GetVoiceInfo
  282.     ENDIF
  283.  
  284. ;
  285. ; pascal OSErr NewSpeechChannel(VoiceSpec *voice, SpeechChannel *chan)
  286. ;
  287.     IF ¬ GENERATINGCFM THEN
  288.         Macro
  289.         _NewSpeechChannel
  290.             dc.w     $203C
  291.             dc.w     $0418
  292.             dc.w     $000C
  293.             dc.w     $A800
  294.         EndM
  295.     ELSE
  296.         IMPORT_CFM_FUNCTION    NewSpeechChannel
  297.     ENDIF
  298.  
  299. ;
  300. ; pascal OSErr DisposeSpeechChannel(SpeechChannel chan)
  301. ;
  302.     IF ¬ GENERATINGCFM THEN
  303.         Macro
  304.         _DisposeSpeechChannel
  305.             dc.w     $203C
  306.             dc.w     $021C
  307.             dc.w     $000C
  308.             dc.w     $A800
  309.         EndM
  310.     ELSE
  311.         IMPORT_CFM_FUNCTION    DisposeSpeechChannel
  312.     ENDIF
  313.  
  314. ;
  315. ; pascal OSErr SpeakString(StringPtr s)
  316. ;
  317.     IF ¬ GENERATINGCFM THEN
  318.         Macro
  319.         _SpeakString
  320.             dc.w     $203C
  321.             dc.w     $0220
  322.             dc.w     $000C
  323.             dc.w     $A800
  324.         EndM
  325.     ELSE
  326.         IMPORT_CFM_FUNCTION    SpeakString
  327.     ENDIF
  328.  
  329. ;
  330. ; pascal OSErr SpeakText(SpeechChannel chan, Ptr textBuf, long textBytes)
  331. ;
  332.     IF ¬ GENERATINGCFM THEN
  333.         Macro
  334.         _SpeakText
  335.             dc.w     $203C
  336.             dc.w     $0624
  337.             dc.w     $000C
  338.             dc.w     $A800
  339.         EndM
  340.     ELSE
  341.         IMPORT_CFM_FUNCTION    SpeakText
  342.     ENDIF
  343.  
  344. ;
  345. ; pascal OSErr SpeakBuffer(SpeechChannel chan, Ptr textBuf, long textBytes, long controlFlags)
  346. ;
  347.     IF ¬ GENERATINGCFM THEN
  348.         Macro
  349.         _SpeakBuffer
  350.             dc.w     $203C
  351.             dc.w     $0828
  352.             dc.w     $000C
  353.             dc.w     $A800
  354.         EndM
  355.     ELSE
  356.         IMPORT_CFM_FUNCTION    SpeakBuffer
  357.     ENDIF
  358.  
  359. ;
  360. ; pascal OSErr StopSpeech(SpeechChannel chan)
  361. ;
  362.     IF ¬ GENERATINGCFM THEN
  363.         Macro
  364.         _StopSpeech
  365.             dc.w     $203C
  366.             dc.w     $022C
  367.             dc.w     $000C
  368.             dc.w     $A800
  369.         EndM
  370.     ELSE
  371.         IMPORT_CFM_FUNCTION    StopSpeech
  372.     ENDIF
  373.  
  374. ;
  375. ; pascal OSErr StopSpeechAt(SpeechChannel chan, long whereToStop)
  376. ;
  377.     IF ¬ GENERATINGCFM THEN
  378.         Macro
  379.         _StopSpeechAt
  380.             dc.w     $203C
  381.             dc.w     $0430
  382.             dc.w     $000C
  383.             dc.w     $A800
  384.         EndM
  385.     ELSE
  386.         IMPORT_CFM_FUNCTION    StopSpeechAt
  387.     ENDIF
  388.  
  389. ;
  390. ; pascal OSErr PauseSpeechAt(SpeechChannel chan, long whereToPause)
  391. ;
  392.     IF ¬ GENERATINGCFM THEN
  393.         Macro
  394.         _PauseSpeechAt
  395.             dc.w     $203C
  396.             dc.w     $0434
  397.             dc.w     $000C
  398.             dc.w     $A800
  399.         EndM
  400.     ELSE
  401.         IMPORT_CFM_FUNCTION    PauseSpeechAt
  402.     ENDIF
  403.  
  404. ;
  405. ; pascal OSErr ContinueSpeech(SpeechChannel chan)
  406. ;
  407.     IF ¬ GENERATINGCFM THEN
  408.         Macro
  409.         _ContinueSpeech
  410.             dc.w     $203C
  411.             dc.w     $0238
  412.             dc.w     $000C
  413.             dc.w     $A800
  414.         EndM
  415.     ELSE
  416.         IMPORT_CFM_FUNCTION    ContinueSpeech
  417.     ENDIF
  418.  
  419. ;
  420. ; pascal short SpeechBusy(void)
  421. ;
  422.     IF ¬ GENERATINGCFM THEN
  423.         Macro
  424.         _SpeechBusy
  425.             dc.w     $203C
  426.             dc.w     $003C
  427.             dc.w     $000C
  428.             dc.w     $A800
  429.         EndM
  430.     ELSE
  431.         IMPORT_CFM_FUNCTION    SpeechBusy
  432.     ENDIF
  433.  
  434. ;
  435. ; pascal short SpeechBusySystemWide(void)
  436. ;
  437.     IF ¬ GENERATINGCFM THEN
  438.         Macro
  439.         _SpeechBusySystemWide
  440.             dc.w     $203C
  441.             dc.w     $0040
  442.             dc.w     $000C
  443.             dc.w     $A800
  444.         EndM
  445.     ELSE
  446.         IMPORT_CFM_FUNCTION    SpeechBusySystemWide
  447.     ENDIF
  448.  
  449. ;
  450. ; pascal OSErr SetSpeechRate(SpeechChannel chan, Fixed rate)
  451. ;
  452.     IF ¬ GENERATINGCFM THEN
  453.         Macro
  454.         _SetSpeechRate
  455.             dc.w     $203C
  456.             dc.w     $0444
  457.             dc.w     $000C
  458.             dc.w     $A800
  459.         EndM
  460.     ELSE
  461.         IMPORT_CFM_FUNCTION    SetSpeechRate
  462.     ENDIF
  463.  
  464. ;
  465. ; pascal OSErr GetSpeechRate(SpeechChannel chan, Fixed *rate)
  466. ;
  467.     IF ¬ GENERATINGCFM THEN
  468.         Macro
  469.         _GetSpeechRate
  470.             dc.w     $203C
  471.             dc.w     $0448
  472.             dc.w     $000C
  473.             dc.w     $A800
  474.         EndM
  475.     ELSE
  476.         IMPORT_CFM_FUNCTION    GetSpeechRate
  477.     ENDIF
  478.  
  479. ;
  480. ; pascal OSErr SetSpeechPitch(SpeechChannel chan, Fixed pitch)
  481. ;
  482.     IF ¬ GENERATINGCFM THEN
  483.         Macro
  484.         _SetSpeechPitch
  485.             dc.w     $203C
  486.             dc.w     $044C
  487.             dc.w     $000C
  488.             dc.w     $A800
  489.         EndM
  490.     ELSE
  491.         IMPORT_CFM_FUNCTION    SetSpeechPitch
  492.     ENDIF
  493.  
  494. ;
  495. ; pascal OSErr GetSpeechPitch(SpeechChannel chan, Fixed *pitch)
  496. ;
  497.     IF ¬ GENERATINGCFM THEN
  498.         Macro
  499.         _GetSpeechPitch
  500.             dc.w     $203C
  501.             dc.w     $0450
  502.             dc.w     $000C
  503.             dc.w     $A800
  504.         EndM
  505.     ELSE
  506.         IMPORT_CFM_FUNCTION    GetSpeechPitch
  507.     ENDIF
  508.  
  509. ;
  510. ; pascal OSErr SetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  511. ;
  512.     IF ¬ GENERATINGCFM THEN
  513.         Macro
  514.         _SetSpeechInfo
  515.             dc.w     $203C
  516.             dc.w     $0654
  517.             dc.w     $000C
  518.             dc.w     $A800
  519.         EndM
  520.     ELSE
  521.         IMPORT_CFM_FUNCTION    SetSpeechInfo
  522.     ENDIF
  523.  
  524. ;
  525. ; pascal OSErr GetSpeechInfo(SpeechChannel chan, OSType selector, void *speechInfo)
  526. ;
  527.     IF ¬ GENERATINGCFM THEN
  528.         Macro
  529.         _GetSpeechInfo
  530.             dc.w     $203C
  531.             dc.w     $0658
  532.             dc.w     $000C
  533.             dc.w     $A800
  534.         EndM
  535.     ELSE
  536.         IMPORT_CFM_FUNCTION    GetSpeechInfo
  537.     ENDIF
  538.  
  539. ;
  540. ; pascal OSErr TextToPhonemes(SpeechChannel chan, Ptr textBuf, long textBytes, Handle phonemeBuf, long *phonemeBytes)
  541. ;
  542.     IF ¬ GENERATINGCFM THEN
  543.         Macro
  544.         _TextToPhonemes
  545.             dc.w     $203C
  546.             dc.w     $0A5C
  547.             dc.w     $000C
  548.             dc.w     $A800
  549.         EndM
  550.     ELSE
  551.         IMPORT_CFM_FUNCTION    TextToPhonemes
  552.     ENDIF
  553.  
  554. ;
  555. ; pascal OSErr UseDictionary(SpeechChannel chan, Handle dictionary)
  556. ;
  557.     IF ¬ GENERATINGCFM THEN
  558.         Macro
  559.         _UseDictionary
  560.             dc.w     $203C
  561.             dc.w     $0460
  562.             dc.w     $000C
  563.             dc.w     $A800
  564.         EndM
  565.     ELSE
  566.         IMPORT_CFM_FUNCTION    UseDictionary
  567.     ENDIF
  568.  
  569.     ENDIF ; __SPEECH__
  570.